<?php
require_once("MysqlConn.php");
require_once("Snack_R.php");
require_once("../util/SimpleMap.php");

class Snacks {
   public function __construct() {
      $this->map = new SimpleMap();
   }

   public function queryInfo($condMap = null) {
      $this->map->clear();

      if($condMap == null) {
         $query = "select * from Snacks;";
      }
      else {
         $query = "select * from Snacks where";
      }

      $conn = new MysqlConn();
      $conn->query($query);

      while($r = $conn->next()) {
         $snack = new Snack_R();
         $snack->parseSqlResult($r);
         $this->map->put($snack->getID(), $snack);
      }
   }

   public function getSnacksMap() {
      return $this->map;
   }

   private $map;
}
?>